#include "opencv2/opencv.hpp"
#include <mutex>
#include <fstream>

typedef unsigned char		u8;
typedef unsigned short		u16;
typedef unsigned int		u32;

#ifdef WIN32
typedef unsigned __int64	u64;
typedef __int64	            s64;
#else
typedef unsigned long long	u64;
typedef long long	        s64;
#endif

/////////////////////////////////////////////////////////////////////////////
class CVideo
{
public:
    cv::VideoCapture m_VC;

    bool        m_ImageGeted;

    std::string	m_MovieName;
    bool		m_Inited;

    long		m_Width;
    long		m_Height;

    double 		m_frameNumbers;
    double 		m_fps;

    long		m_origWidth;
    long		m_origHeight;

    double		m_Duration;
    double		m_Pos;


    cv::Mat 	m_cur_frame;
	cv::Mat		m_rec_image;
    std::string	m_log;
    std::string	m_Dir;

public:
    CVideo();
    ~CVideo();
    bool OpenMovie(std::string csMovieName, int type);
    bool CloseMovie();
    void SetPos(s64 Pos);
    void SetPos(double pos);
    void SetPosFast(s64 Pos);
    void OneStep();
    s64  GetPos();
	bool GetImage(cv::Rect rec);
};

